/** 
 * 
 * Licensed under the MIT License and Apache License version 2.0
 * 
 * Copyright (c) 2011 Jazz Digital (http://www.jazz.etc.br) 
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy of
 * this software and associated documentation files (the "Software"), to deal in
 * the Software without restriction, including without limitation the rights to
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
 * the Software, and to permit persons to whom the Software is furnished to do so,
 * subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 * 
 * http://www.opensource.org/licenses/mit-license.php
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 * http://code.google.com/p/kinect-jazztures/
 * 
 * @author Valério Oliveira (valck) - http://www.valck.in
 * @author João Marquesini - http://www.markezine.me
 * @author Gabriel Tavares de Souza - http://www.gtsouza.com
 * 
 */
package jazztures.events{
	
	import flash.events.Event;
	
	/**
	 * 
	 * Creates an <code>UserEvent</code> object to pass as a parameter to cursor events listeners.
	 * 
	 */
	public class UserEvent extends Event{

		public static const ADD_USER : String = "add_user";
		public static const REMOVE_USER : String = "remove_user";
		
		private var _id : uint;

		/**
		 * 
		 * Creates an <code>UserEvent</code> object to pass as a parameter to cursor events listeners.
		 * 
		 * @param p_type The type of the event, accessible as UserEvent.ADD_USER and UserEvent.REMOVE_USER.
		 * @param p_id The id (<code>uint</code>) received from the server.
		 * @param p_bubbles Determines whether the UserEvent object participates in the bubbling stage of the event flow. The default value is <code>false</code>.
		 * @param p_cancelable Determines whether the UserEvent object can be canceled. The default values is <code>false</code>. 
		 * 
		 */
		public function UserEvent(p_type:String, p_id:uint, p_bubbles:Boolean=true, p_cancelable:Boolean=false){
			_id = p_id;
			
			super(p_type, p_bubbles, p_cancelable);
		}
		
		/**
		 * 
		 * Indicates the id of the <code>User</code>.
		 * 
		 * @return <code>uint</code> 
		 * 
		 */
		public function get id():uint{
			return _id;
		}
		
		/**
		 * 
		 * Indicates the id of the <code>User</code>.
		 * 
		 * @param p_value The id (<code>uint</code>).
		 * 
		 */
		public function set id(p_value:uint):void{
			_id = p_value;
		}
		
		/**
		 * 
		 * The new <code>UserEvent</code> object includes all the properties of the original. 
		 * 
		 * @return <code>UserEvent</code>
		 * 
		 */
		public override function clone():Event{
			return new UserEvent(type, id, bubbles, cancelable);
		}
		
		/**
		 * 
		 * Returns a string containing all the properties of the <code>UserEvent</code> object.
		 * 
		 * @return The string is in the following format: [UserEvent type=value id=value bubbles=value cancelable=value]
		 * 
		 */
		public override function toString():String{
			return formatToString("UserEvent", "type", "id", "bubbles", "cancelable");
		}
	}
}